import type { AddRuleParams, Rule, RuleListData, RuleListParams } from "@/types/car"
import { request } from "@/utils/reuqest"

/**
 * 获取规则列表
 */
export const getRuleListAPI = (params: RuleListParams) => {
    return request<RuleListData>('/parking/rule/list', 'GET', params)
  }

//   添加计费规则
export const addRuleAPI = (data: AddRuleParams) => {
    return request('/parking/rule', 'POST', data)
  }

//   删除计费规则
export const  deleteRuleAPI = (id: number) => {
    return request(`/parking/rule/${id}`, 'DELETE')
}

// 查看计费规则详情
export const getRuleAPI = (id: number) => {
  return request<Rule>(`/parking/rule/${id}`, 'GET')
}
           
// 编辑计费规则
export const editRuleAPI = (data: Rule) => {
  return request('/parking/rule', 'PUT', data)
}
